package com.spring.cloud.controller;

import com.alibaba.fastjson.JSONObject;
import com.spring.cloud.entity.Week01;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by qpx on 2018/4/14.
 */
@RestController
@RequestMapping("/helloRibbon")
public class HelloWorldController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping(method = RequestMethod.GET)
    public Week01 queryWeek(@RequestParam Integer id) {
        Week01 week01 = restTemplate.getForEntity("http://PRODUCER/springBoot/week?abc=1", Week01.class).getBody();
        return week01;
    }
}
